{include file="public/header" /}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}
{load href="__PLUGINS__layui/layui.js"}
{load href="__PLUGINS__layui/css/layui.css"}
<style type="text/css">
    #des,#des input{ width: 40px;text-align:center;}
    #id{ width: 78px; }
    .bs-checkbox{ width: 36px; height: 40px }
    .fixed-table-toolbar .columns,.fixed-table-toolbar .search{margin-left:0px; margin-top: 0px }
    #title span{ float: right; margin-left: 3.333px;}
    .search{ margin-bottom: 0px !important; }
    .asdlkjasd{ background: #1ab394; color: #fff}
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content {:config('adminClass.main')}">
    <div class="ibox float-e-margins">
        {include file="public/tophead"}
        {include file="public/top" /}
        <div class="ibox-content">
            {include file="public/topsection"}
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="example">
                        <form class="form-horizontal" method="post">
                            <table data-toggle="table">
                                <thead>
                                <tr>
                                    <th class="bs-checkbox"><input type="checkbox" id="delidAll"></th>
                                    <th data-align="center">id</th>
                                    <th data-align="center">标题</th>
                                    <th>内容</th>
                                    <th data-align="center">管理</th>
                                </tr>
                                </thead>
                                <tbody id="form">
                                {volist name="data" id="v"}
                                <tr id="id{$v.id}" class="class">
                                    <td id="delid" ><input name="delAll[]" type="checkbox" value="{$v.id}"></td>
                                    <td id="id">{$v.id}</td>
                                    <td>
                                        {eq name='$v.title' value='menu'}
                                            <a onclick="add('{:url('lists',['url'=>-1])}')">
                                        {/eq}{$v.description}
                                    </td>

                                    <td id="title">
                                        <a onclick="">
                                            {:_substr(strip_tags($v.content))}

                                            <!--<span class="label label-danger">预览</span>-->
                                        </a>
                                    </td>
                                    <td>
                                        <div class="btn-group">
                                            <div data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">操作 <span class="caret"></span>
                                            </div>
                                            <ul class="dropdown-menu">
                                                <li><a onclick="add('{:url('kefuadd',['id' => $v.id, 'url'=>-1])}')">修改</a></li>
                                                {neq name='$v.title' value='id'}
                                                    <li><a onclick="add('{:url('lists',['id' => $v.id, 'url'=>-1])}')">菜单</a></li>
                                                {/neq}
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                                {/volist}
                                </tbody>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
            <hr>
            <div class="row row-lg">
                <div class="col-sm-6 pages">{$page}</div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript">
    $(document).ready(function(){
        $('#desAll').click(function(){
            var des=$(".form-horizontal").serialize();
            ajaxFun("post",'{:url('article/desAll')}',des,'json',function(ret){
                if(ret){
                    if(ret.ret){
                        self.location.reload();
                    }else{
                        layer.msg(ret.err)
                    }
                }else{
                    swal_msg("错误",ret,"error");
                }
            })
        })

        $('#delidAll').click(function(){
            $('input[type=checkbox]').each(function(){
                var self=$(this);
                if(!self.prop('checked')){
                    self.prop('checked',true);
                }else{
                    self.prop('checked',false);
                }
            });
        })
    });
    function del(id){
        swal_del(id,"{:url('peidel')}")
    }
    function alla(types){
        var all=$(".form-horizontal").serialize();
        var alls=$(".form-horizontal").serializeArray();
        //console.log(JSON.stringify(alls))

        ajaxFun("post",'{:url('system/delAll')}?type='+types,all,'json',function(ret){

            if(ret){
                var text
                switch(types)
                {
                    case 0:
                        text='<font color="#f00">隐藏</font>';
                        break;
                    case 1:
                        text='<font color="#1ab394">通过</font>'
                        break;
                    case 2:
                        text ='审核';
                        break;
                    case 3:
                        text ='<font color="#f00">拒绝</font>';
                        break;
                }
                for(var i=0;i<alls.length;i++){
                    if(types=='del'){
                        $('#id'+alls[i]['value']).remove();
                    }else{
                        $('#hide'+alls[i]['value']).html(text);
                    }
                }

                swal_msg('操作成功')
            }
        })

    }
    function watch(id) {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url('system/watch')}?id='+id // //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
        });


        });
    }
</script>
 